package com.huangjian.controller;

import com.huangjian.pojo.User;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @GetMapping("/hello/user")
    public String hello() {
        return  "hello,user!";
    }

    @PostMapping("/hello2/user")
    @ApiOperation("hello控制类")   //@ApiOperation给方法加注释
    public String hello2(@ApiParam("用户名") String name) {
        return  "hello"+name;
    }

    //只要接口中的返回值是实体类，就会被扫描到swagger中的models中
    @PostMapping("/user")
    public User user() {
        return  new User();
    }
}
